package cn.iocoder.yudao.module.written.exam.dal.mysql.userwrittenexamrecords;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.written.exam.controller.admin.member.vo.WrittenExamMemberRespVO;
import cn.iocoder.yudao.module.written.exam.controller.admin.userwrittenexamrecords.vo.UserWrittenExamRecordsPageReqVO;
import cn.iocoder.yudao.module.written.exam.dal.dataobject.userwrittenexamrecords.UserWrittenExamRecordsDO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;

/**
 * 笔试记录 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserWrittenExamRecordsMapper extends BaseMapperX<UserWrittenExamRecordsDO> {

    default PageResult<UserWrittenExamRecordsDO> selectPage(UserWrittenExamRecordsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserWrittenExamRecordsDO>()
                .betweenIfPresent(UserWrittenExamRecordsDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserWrittenExamRecordsDO::getUserId, reqVO.getUserId())
                .orderByDesc(UserWrittenExamRecordsDO::getId));
    }

    Page<WrittenExamMemberRespVO> selectUserIdsPage(
            Page<UserWrittenExamRecordsDO> page
    );

}